@layout("/common/lyy/_container.html"){
 <div data-options="region:'north',border:false,collapsible:false,minHeight:30">
    	 <div id="toolbar" style="display: none;">
                <a onclick="uploadProduct();" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-reload'">标记为可上传药品</a>
         
                </div>
        <div style="margin-top: 4px">
        <input id="searchKey" name="searchKey" '> <input id="searchWord"
                name="searchWord" '>
        </div>
    </div>
    <div data-options="region:'center',border:false,">
        <div id="mainDatagrid"></div>
    </div>
    <div id="viewWindow_orgProductSku" style="padding: 10px 20px"></div>
<script type="text/javascript">
	var searchKey;
	var searchWord;

	$(function() {
		searchKey = $('#searchKey').val();
		searchWord = $('#searchWord').val();

		$('#mainDatagrid')
				.datagrid(
						{
							url : Feng.ctxPath + "/client/list",
							queryParams : {
								searchKey : searchKey,
								searchWord : searchWord
							},
							pagination : true,
							rownumbers : true,
							fit : true,
							fitColumns : true,
							singleSelect : true,
							border : true,
							remoteSort : false,
							pageSize : 20,
							columns : [ [ {
								field : 'id',
								title : '编号',
								sortable : true
							}, {
								field : 'clientId',
								title : '连锁客户编码',
								sortable : true
							}, {
								field : 'clientSecret',
								title : '密码',
								sortable : true
							},
							{
								field : 'action',
								title : '操作',
								width : 120,
								formatter : function(value, row, index) {
									var str = '&nbsp;';
									str += $.formatString(
													'<a href="javascript:void(0)"   class="edit">编辑</a>',
													row.resourceId);
									str += '&nbsp;&nbsp;|&nbsp;&nbsp;';
									str += $.formatString(
													'<a href="javascript:void(0)"   class="del">删除</a>',
													row.resourceId);
									return str;
								}
							}] ],
							toolbar :'#toolbar'
						});

        
		

		$('#searchKey').combobox({
			valueField : 'id',
			textField : 'title',
			editable : false,
			value : 'drugCode',
			width : 80,
			data : [ {
				title : '药品编码',
				id : 'drugCode'
			}, {
				title : '药品内码',
				id : 'inCode'
			}, {
				title : '商品名称',
				id : 'drugName'
			}, {
				title : '生产厂家',
				id : 'factory'
			}, {
				title : '批准文号',
				id : 'approval'
			} ],
			onSelect : function(record) {
				searchKey = $('#searchKey').combobox('getValue');
			}
		});
		$('#searchWord').textbox({
			buttonText : '查找',
			iconCls : 'icon-search',
			iconAlign : 'right',
			onClickButton : function() {
				reloadMainDataGrid();
			},
			onChange : function(newValue, oldValue) {
				searchKey = $('#searchKey').combobox('getValue');
				searchWord = $('#searchWord').textbox('getValue');
			}
		});

	});
	//事件委托
	$(document).on("click",".edit",function(){
		var row = $('#mainDatagrid')
		.datagrid('getSelected');
		console.log(row)
		alert(row.id)
	})
	function reloadMainDataGrid() {
		$('#mainDatagrid').datagrid("load", {
			searchKey : searchKey,
			searchWord : searchWord
		});
	}
	
	function uploadProduct(){
		alert("成功")
	}
	
</script>
@}